package org.yatr.ttcn.rt.impl;

import org.etsi.ttcn.tci.TciParameter;
import org.etsi.ttcn.tci.TciParameterPassingMode;
import org.etsi.ttcn.tci.Value;

public class TciParameterImpl implements TciParameter {

	private static final long serialVersionUID = -6601478518851426230L;
    private String parameterName = "";
    private int parameterPassingMode = TciParameterPassingMode.TCI_INOUT;
    private Value parameter = null;

    private TciParameterImpl() {
    }

    /**
     * Creates a new TciParameterImpl object. The default parameter passing mode TCI_INOUT.
     *
     * @param parameter the parameter of type Value
     */
    public TciParameterImpl(Value parameter)
    {
        this(parameter, TciParameterPassingMode.TCI_INOUT);
    }

    /**
     * Creates a new TciParameterImpl object with a given parameter passing mode.
     *
     * @param parameter the parameter of type Value
     * @param mode the parameter passing mode (can be TciParameterPassingMode.TCI_IN,
     *                 TciParameterPassingMode.TCI_INOUT or TciParameterPassingMode.TCI_OUT)
     */
    public TciParameterImpl(Value parameter, int mode)
    {
        this.parameter = parameter;
        this.parameterPassingMode = mode;
    }
    
    /**
     * Creates a new TciParameterImpl object. The default parameter passing mode TCI_INOUT.
     *
     * @param parameter the parameter of type Value
     * @param paramName the name of the parameter
     */
    public TciParameterImpl(Value parameter, String paramName)
    {
        this.parameter = parameter;
        this.parameterName = paramName;
    }  

    /**
     * Creates a new TciParameterImpl object with a given parameter passing mode 
     * and a parameter name.
     *
     * @param parameter the parameter of type Value
     * @param mode the parameter passing mode (can be TciParameterPassingMode.TCI_IN,
     *                 TciParameterPassingMode.TCI_INOUT or TciParameterPassingMode.TCI_OUT)
     * @param paramName	the name of the parameter
     */
    public TciParameterImpl(Value parameter, int mode, String paramName)
    {
        this.parameter = parameter;
        this.parameterPassingMode = mode;
        this.parameterName = paramName;
    }  


	public Value getParameter() {
		return parameter;
	}

    /** Returns the parameter name as defined in the TTCN-3
     * specification.
     * 
     * @return if no paramteer name is set,an empty string is returned.
     */
	public String getParameterName() {
		return parameterName;
	}

	public int getParameterPassingMode() {
		return parameterPassingMode;
	}

	public void setParameter(Value parameter) {
		this.parameter = parameter;
	}

	public void setParameterName(String name) {
		this.parameterName = name;
	}

	public void setParameterPassingMode(int mode) {
		this.parameterPassingMode = mode;
	}

}
